#ifndef ADVANCEDTEXTBROWSER_H
#define ADVANCEDTEXTBROWSER_H

#include "../utils_global.h"
#include <QTextBrowser>
#include <QTextLayout>
#include <QColor>
namespace TWUtils {
namespace UI {

	class TWUTILS_EXPORT AdvancedTextBrowser : public QTextBrowser
	{
		Q_OBJECT
		public:
			explicit AdvancedTextBrowser(QWidget* p):QTextBrowser(p),isHoveringLink(false){}
			void setHtml(const QString& text);

			static void setDefaultLinkColor(const QColor& c){ defaultLinkColor = c; }
		protected:
			void mouseMoveEvent(QMouseEvent* e);
			void leaveEvent(QEvent*);
		private:
			void revertAllFormat(QTextCursor&);
			bool isHoveringLink;

			static QColor defaultLinkColor;
	};
}
}
#endif // ADVANCEDTEXTBROWSER_H
